﻿using DataModels.Enums.Home;
using SqlSugar;
using static DataModels.Enums.GeneralEnum;

namespace DataModels.Entities.HomeService
{
    [SugarTable]
    public class HomeServiceOrder
    {
        [SugarColumn(IsPrimaryKey = true)]
        public Guid UUID { get; set; }

        /// <summary>   
        /// 订单编号
        /// </summary>
        public string OrderNo { get; set; } = Utils.MicrosecondTimeStamp.GenerateUniqueId();

        /// <summary>
        /// 商品UUID
        /// </summary>
        public Guid ProductUUID { get; set; }

        /// <summary>
        /// 商品规格UUID
        /// </summary>
        public Guid ProductSpecificationUUID { get; set; }

        /// <summary>
        /// 购买数量
        /// </summary>
        public int Count { get; set; }

        /// <summary>
        /// 订单金额
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 支付金额
        /// </summary>
        public decimal PayAmount { get; set; }

        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal DiscountAmount { get; set; } = 0;

        /// <summary>
        /// 服务地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 联系人姓名
        /// </summary>
        public string ContactPerson { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContactPhone { get; set; }

        /// <summary>
        /// 服务计划开始时间
        /// </summary>
        public DateTime? ServiceStartTime { get; set; }

        /// <summary>
        /// 服务实际结束时间
        /// </summary>
        public DateTime? ServiceEndTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public HomeServcieOrderStatus OrderStatus { get; set; } = HomeServcieOrderStatus.PendingPayment;

        /// <summary>
        /// 拼团订单
        /// </summary>
        public Status IsGroup { get; set; } = Status.Disable;

        /// <summary>
        /// 订单过期时间 - 默认未付款15分钟后过期
        /// </summary>
        public DateTime? ExpireTime { get;set; } = DateTime.Now.AddMinutes(15);

        public DateTime CreateTime { get; set; } = DateTime.Now;
        public DateTime UpdateTime { get; set; }

        public Guid CreateUserUUID { get; set; }

        public Guid UpdateUserUUID { get; set; }

        /// <summary>
        /// 删除标记
        /// </summary>
        public Status IsDeleted { get; set; } = Status.Disable;

        /// <summary>
        /// 商品名称
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string ProductName { get; set; }

        /// <summary>
        /// 商品图片
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string Image { get; set; }

        /// <summary>
        /// 商品
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public HomeServiceProduct Product { get; set; }

        /// <summary>
        /// 商品规格
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public HomeServiceProductSpecification ProductSpecification { get; set; }

    }
}
